package zengjin.common;

import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author 19324
 */
@Data
public class R<T> implements Serializable {
    /**
     * 结果
     */
    private boolean flag;
    /**
     * 数据
     */
    private T data;

    /**
     * 描述
     */
    private String message;

    public R(boolean flag, T data,String message){
        this.flag = flag;
        this.data = data;
        this.message = message;
    }

    public static <T> R<T> success(T data,String message){
        return new R<>(true,data,message);
    }

    public static <T> R<T> error(T data,String message){
        return new R<>(false,data,message);
    }

    @Serial
    private static final long serialVersionUID = 1L;
}
